package com.dongnam.quanly.common.dao;

import java.io.Serializable;
import java.util.Date;

import com.dongnam.quanly.common.model.BaseEntity;

public class ExtendedGenericDao<T, ID extends Serializable> extends GenericDao<T, ID> {

	// @Override
	public T makePersistent(T entity) {
		if (entity instanceof BaseEntity) {
			if (((BaseEntity) entity).getCreateDate() == null) {
				((BaseEntity) entity).setCreateDate(new Date());
			}

			((BaseEntity) entity).setUpdateDate(new Date());
		}

		return super.makePersistent(entity);
	}

}
